Regularization¶

Regularization is about preventing the model from "memorizing" our specific Santa images and forcing it to learn general features that define a "Santa" in any environment.

Now that we know our model and data pipeline are working OK, the next steps in the Karpathy Recipe are to re-enable regularization.

There are several elements to that:

  1. With L2 regularization we add a penalty on large weights. It prevents overfitting. (weight_decay=0.0005)

  2. Data augmentation increases data diversity and helps overcome limitations of our small dataset. Rotation, scaling, flipping, color adjustments and mosaic recombinations all help make the model more robust to real-life variations. (augment=True)

  3. Dropout randomly deactivates a fraction of neurons during each training step, which prevents the network from relying too heavily on specific pathways and forces it to generalize. The principle behind dropout as regularization is adding some noise to the intermediate output of neurons during the training process.(dropout=0.1)

  4. Early stopping: if the validation loss stops improving (or starts increasing) for a specified number of epochs, the training is stopped. (patience=20)

Process of Object Detection¶

yolo.png.png

Source

In [ ]:
## For when the Notebook hangs up
# drive.flush_and_unmount()
# !sudo killall apt apt-get 2>/dev/null
# !rm -rf /var/lib/dpkg/lock*
# !rm -rf /var/cache/apt/archives/lock
In [ ]:
from google.colab import drive
drive.mount('/content/drive/')
In [ ]:
# If the notebook is run from the original or from shared location:
%cd /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC
# %cd /content/drive/MyDrive/FHNW/MC

from helpers import (
    save_weights_to_drive,
    visualize_training_results,
    display_yolo_plots,
    diagnose_training_results
)
/content/drive/.shortcut-targets-by-id/1DgLXJnKkWgH1Se3L7wSkYBuXljrUEqpi/MC
In [ ]:
!nvidia-smi
Mon Jan 12 02:43:13 2026       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.54.15              Driver Version: 550.54.15      CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA A100-SXM4-40GB          Off |   00000000:00:04.0 Off |                    0 |
| N/A   31C    P0             48W /  400W |       0MiB /  40960MiB |      0%      Default |
|                                         |                        |             Disabled |
+-----------------------------------------+------------------------+----------------------+
                                                                                         
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |
+-----------------------------------------------------------------------------------------+

Install Dependencies & Authentication (Ultralitycs and Weights & Biases)¶

In [ ]:
# Install YOLO library
!pip install ultralytics -q

from IPython import display
display.clear_output()

# prevent ultralytics from tracking activity
!yolo settings sync=False

import ultralytics
ultralytics.checks()

from ultralytics import YOLO
Ultralytics 8.3.252 🚀 Python-3.12.12 torch-2.9.0+cu126 CUDA:0 (NVIDIA A100-SXM4-40GB, 40507MiB)
Setup complete ✅ (12 CPUs, 83.5 GB RAM, 38.5/112.6 GB disk)
In [ ]:
# W&B login
!pip install wandb -q
import wandb
from google.colab import userdata
WANDB_API_KEY = userdata.get('WANDB_API_KEY')
wandb.login(key=WANDB_API_KEY)
/usr/local/lib/python3.12/dist-packages/notebook/notebookapp.py:191: SyntaxWarning: invalid escape sequence '\/'
  | |_| | '_ \/ _` / _` |  _/ -_)

1. Load model and model metadata about the datasets¶

In [ ]:
import os
import shutil
from ultralytics import YOLO

# --- LOAD MODEL FROM CACHE ---
DRIVE_PATH = '/content/drive/My Drive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/models_cache/'
MODEL_PATH = 'models_cache/yolov8n.pt' # Nano

os.makedirs(DRIVE_PATH, exist_ok=True)

if os.path.exists(MODEL_PATH):
    print(f"✅ Loading from cache: {MODEL_PATH}")
    model = YOLO(MODEL_PATH)
else:
    print(f"⬇️ Downloading {MODEL_NAME}...")
    model = YOLO(MODEL_NAME)
    source = MODEL_NAME if os.path.exists(MODEL_NAME) else os.path.expanduser(f'~/.config/ultralytics/{MODEL_NAME}')
    if os.path.exists(source):
        shutil.copyfile(source, MODEL_PATH)
        if source == MODEL_NAME:
            os.remove(MODEL_NAME)
        print(f"✅ Saved to Drive: {MODEL_PATH}")

# Set up data location
dataset_yaml = 'Santa-10/data.yaml'
✅ Loading from cache: models_cache/yolov8n.pt
In [ ]:
regularized_config_1 = {
    'data': dataset_yaml,
    'epochs': 180,            # Limited epochs to prevent overfitting
    'batch': 16,              # Smaller batch size
    'patience': 20,           # Triggers early stopping after 20 epochs without improvement
    'device': 0,
    'augment': True,          # Enable augmentation
    'lr0': 0.01,              # Initial learning rate (default is ~0.01)
    'weight_decay': 0.005,    # L2 regularization (default: 0.005)
    'dropout': 0.1,           # Dropout rate (0.0-0.5, applied in classification head)
    'optimizer': 'Adam',      # Or 'SGD', but Adam better for small datasets
    'verbose': True,
    'save': True,
    'project': 'runs/regularize',
    'name': 'regularize_run_1',
    'val': True,
    'exist_ok': True,
    'freeze': None            # No frozen layers (all layers trainable)
}

About the chosen parameters:¶

  1. By choosing YOLO Nano over Small we are trying to trade trading off model capacity for better generalization.Because it has fewer weights, it is physically harder for the model to "memorize" every pixel of our images .It has less storage space to memorize noise and specific backgrounds, and thus worksd as a structural regularizer.

  2. 180 epochs is a safer ceiling than 250 to not overfit.

  3. If the Validation mAP stops improving for 20 epochs, patience=20 kills the run.

  4. Dropout 0.1 means that during training 10% of neurons are randomly deactivated, which forces the classification head not to rely on any single set of neurons.

  5. weight_decay is L2 penalty that keeps weights small. Default is 0.0005, but it appears to be too small for our data.

Train Models with Regularization¶

Run 1: Nano YOLO¶

In [ ]:
# YOLO nano
model = YOLO(MODEL_PATH)
In [ ]:
# # --- RUN 1
# --- TRAIN ---
print("🚀 Starting training (designed NOT to overfit) ...")
results = model.train(**regularized_config_1)
🚀 Starting training (designed NOT to overfit) ...
Ultralytics 8.3.252 🚀 Python-3.12.12 torch-2.9.0+cu126 CUDA:0 (NVIDIA H100 80GB HBM3, 81224MiB)
engine/trainer: agnostic_nms=False, amp=True, augment=True, auto_augment=randaugment, batch=16, bgr=0.0, box=7.5, cache=False, cfg=None, classes=None, close_mosaic=10, cls=0.5, compile=False, conf=None, copy_paste=0.0, copy_paste_mode=flip, cos_lr=False, cutmix=0.0, data=Santa-10/data.yaml, degrees=0.0, deterministic=True, device=0, dfl=1.5, dnn=False, dropout=0.1, dynamic=False, embed=None, epochs=180, erasing=0.4, exist_ok=True, fliplr=0.5, flipud=0.0, format=torchscript, fraction=1.0, freeze=None, half=False, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, imgsz=640, int8=False, iou=0.7, keras=False, kobj=1.0, line_width=None, lr0=0.01, lrf=0.01, mask_ratio=4, max_det=300, mixup=0.0, mode=train, model=models_cache/yolov8n.pt, momentum=0.937, mosaic=1.0, multi_scale=False, name=regularize_run_1, nbs=64, nms=False, opset=None, optimize=False, optimizer=Adam, overlap_mask=True, patience=20, perspective=0.0, plots=True, pose=12.0, pretrained=True, profile=False, project=runs/regularize, rect=False, resume=False, retina_masks=False, save=True, save_conf=False, save_crop=False, save_dir=/content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/runs/regularize/regularize_run_1, save_frames=False, save_json=False, save_period=-1, save_txt=False, scale=0.5, seed=0, shear=0.0, show=False, show_boxes=True, show_conf=True, show_labels=True, simplify=True, single_cls=False, source=None, split=val, stream_buffer=False, task=detect, time=None, tracker=botsort.yaml, translate=0.1, val=True, verbose=True, vid_stride=1, visualize=False, warmup_bias_lr=0.1, warmup_epochs=3.0, warmup_momentum=0.8, weight_decay=0.0005, workers=8, workspace=None
Downloading https://ultralytics.com/assets/Arial.ttf to '/root/.config/Ultralytics/Arial.ttf': 100% ━━━━━━━━━━━━ 755.1KB 36.9MB/s 0.0s
Overriding model.yaml nc=80 with nc=1

                   from  n    params  module                                       arguments                     
  0                  -1  1       464  ultralytics.nn.modules.conv.Conv             [3, 16, 3, 2]                 
  1                  -1  1      4672  ultralytics.nn.modules.conv.Conv             [16, 32, 3, 2]                
  2                  -1  1      7360  ultralytics.nn.modules.block.C2f             [32, 32, 1, True]             
  3                  -1  1     18560  ultralytics.nn.modules.conv.Conv             [32, 64, 3, 2]                
  4                  -1  2     49664  ultralytics.nn.modules.block.C2f             [64, 64, 2, True]             
  5                  -1  1     73984  ultralytics.nn.modules.conv.Conv             [64, 128, 3, 2]               
  6                  -1  2    197632  ultralytics.nn.modules.block.C2f             [128, 128, 2, True]           
  7                  -1  1    295424  ultralytics.nn.modules.conv.Conv             [128, 256, 3, 2]              
  8                  -1  1    460288  ultralytics.nn.modules.block.C2f             [256, 256, 1, True]           
  9                  -1  1    164608  ultralytics.nn.modules.block.SPPF            [256, 256, 5]                 
 10                  -1  1         0  torch.nn.modules.upsampling.Upsample         [None, 2, 'nearest']          
 11             [-1, 6]  1         0  ultralytics.nn.modules.conv.Concat           [1]                           
 12                  -1  1    148224  ultralytics.nn.modules.block.C2f             [384, 128, 1]                 
 13                  -1  1         0  torch.nn.modules.upsampling.Upsample         [None, 2, 'nearest']          
 14             [-1, 4]  1         0  ultralytics.nn.modules.conv.Concat           [1]                           
 15                  -1  1     37248  ultralytics.nn.modules.block.C2f             [192, 64, 1]                  
 16                  -1  1     36992  ultralytics.nn.modules.conv.Conv             [64, 64, 3, 2]                
 17            [-1, 12]  1         0  ultralytics.nn.modules.conv.Concat           [1]                           
 18                  -1  1    123648  ultralytics.nn.modules.block.C2f             [192, 128, 1]                 
 19                  -1  1    147712  ultralytics.nn.modules.conv.Conv             [128, 128, 3, 2]              
 20             [-1, 9]  1         0  ultralytics.nn.modules.conv.Concat           [1]                           
 21                  -1  1    493056  ultralytics.nn.modules.block.C2f             [384, 256, 1]                 
 22        [15, 18, 21]  1    751507  ultralytics.nn.modules.head.Detect           [1, [64, 128, 256]]           
Model summary: 129 layers, 3,011,043 parameters, 3,011,027 gradients, 8.2 GFLOPs

Transferred 319/355 items from pretrained weights
Freezing layer 'model.22.dfl.conv.weight'
AMP: running Automatic Mixed Precision (AMP) checks...
AMP: checks passed ✅
train: Fast image access ✅ (ping: 0.4±0.1 ms, read: 0.1±0.0 MB/s, size: 32.3 KB)
train: Scanning /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/Santa-10/train/labels.cache... 700 images, 327 backgrounds, 0 corrupt: 100% ━━━━━━━━━━━━ 700/700 154.5Mit/s 0.0s
albumentations: Blur(p=0.01, blur_limit=(3, 7)), MedianBlur(p=0.01, blur_limit=(3, 7)), ToGray(p=0.01, method='weighted_average', num_output_channels=3), CLAHE(p=0.01, clip_limit=(1.0, 4.0), tile_grid_size=(8, 8))
val: Fast image access ✅ (ping: 0.4±0.1 ms, read: 0.1±0.0 MB/s, size: 31.2 KB)
val: Scanning /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/Santa-10/valid/labels.cache... 155 images, 54 backgrounds, 0 corrupt: 100% ━━━━━━━━━━━━ 155/155 12.7Mit/s 0.0s
Plotting labels to /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/runs/regularize/regularize_run_1/labels.jpg... 
optimizer: Adam(lr=0.01, momentum=0.937) with parameter groups 57 weight(decay=0.0), 64 weight(decay=0.0005), 63 bias(decay=0.0)
Image sizes 640 train, 640 val
Using 8 dataloader workers
Logging results to /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/runs/regularize/regularize_run_1
Starting training for 180 epochs...

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      1/180      2.14G      1.795      2.728      2.109         16        640: 100% ━━━━━━━━━━━━ 44/44 3.2it/s 13.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 4.3s/it 21.6s
                   all        155        105    0.00407      0.781    0.00403    0.00133

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      2/180      2.62G      2.085      2.719      2.384         22        640: 100% ━━━━━━━━━━━━ 44/44 19.5it/s 2.3s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 15.8it/s 0.3s
                   all        155        105          0          0          0          0

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      3/180      2.64G      2.015      2.677      2.329         16        640: 100% ━━━━━━━━━━━━ 44/44 19.8it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 16.2it/s 0.3s
                   all        155        105   0.000891      0.152    0.00038   9.26e-05

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      4/180      2.64G      1.945      2.553      2.224         17        640: 100% ━━━━━━━━━━━━ 44/44 21.0it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 17.7it/s 0.3s
                   all        155        105    0.00121     0.0381   0.000411     0.0001

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      5/180      2.64G      1.925      2.467      2.192         22        640: 100% ━━━━━━━━━━━━ 44/44 20.2it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 17.7it/s 0.3s
                   all        155        105     0.0749      0.257     0.0459     0.0133

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      6/180      2.64G      1.818      2.369      2.131         19        640: 100% ━━━━━━━━━━━━ 44/44 21.1it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.7it/s 0.3s
                   all        155        105      0.117     0.0476     0.0219    0.00468

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      7/180      2.66G      1.907       2.38      2.155         14        640: 100% ━━━━━━━━━━━━ 44/44 20.5it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.5it/s 0.3s
                   all        155        105     0.0789     0.0952     0.0509    0.00956

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      8/180      2.67G      1.794      2.303      2.083         35        640: 100% ━━━━━━━━━━━━ 44/44 21.1it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.7it/s 0.3s
                   all        155        105     0.0385      0.162     0.0204    0.00431

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      9/180      2.67G      1.725       2.22      2.026         18        640: 100% ━━━━━━━━━━━━ 44/44 21.3it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.0it/s 0.3s
                   all        155        105      0.141      0.124      0.128     0.0304

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     10/180      2.67G      1.669       2.15      1.964         22        640: 100% ━━━━━━━━━━━━ 44/44 21.9it/s 2.0s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.5it/s 0.3s
                   all        155        105      0.119      0.276     0.0992     0.0313

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     11/180      2.69G      1.733      2.209      2.016         11        640: 100% ━━━━━━━━━━━━ 44/44 19.4it/s 2.3s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.7it/s 0.3s
                   all        155        105      0.393      0.571      0.353      0.141

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     12/180      2.69G      1.764      2.198      2.022         20        640: 100% ━━━━━━━━━━━━ 44/44 20.6it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 16.9it/s 0.3s
                   all        155        105      0.376      0.298      0.261     0.0959

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     13/180      2.69G      1.587      2.088      1.904         12        640: 100% ━━━━━━━━━━━━ 44/44 21.2it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 17.3it/s 0.3s
                   all        155        105      0.312      0.257      0.196      0.073

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     14/180      2.69G      1.601      2.053      1.893         10        640: 100% ━━━━━━━━━━━━ 44/44 21.3it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.4it/s 0.3s
                   all        155        105      0.199        0.4      0.181     0.0508

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     15/180      2.69G      1.644      2.107      1.947         15        640: 100% ━━━━━━━━━━━━ 44/44 21.8it/s 2.0s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.0it/s 0.3s
                   all        155        105      0.302      0.333      0.258     0.0862

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     16/180      2.69G      1.636      2.078       1.93         21        640: 100% ━━━━━━━━━━━━ 44/44 21.7it/s 2.0s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.5it/s 0.3s
                   all        155        105      0.328      0.467      0.273      0.105

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     17/180      2.69G      1.587      1.995      1.883         16        640: 100% ━━━━━━━━━━━━ 44/44 20.6it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.7it/s 0.3s
                   all        155        105      0.306      0.486      0.313      0.117

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     18/180      2.69G      1.579      2.075      1.872         15        640: 100% ━━━━━━━━━━━━ 44/44 20.8it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 21.4it/s 0.2s
                   all        155        105      0.259      0.105     0.0804     0.0236

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     19/180      2.69G      1.557      2.025      1.848         15        640: 100% ━━━━━━━━━━━━ 44/44 20.9it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.9it/s 0.3s
                   all        155        105      0.354      0.271      0.294     0.0924

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     20/180      2.69G      1.545      1.951      1.857         16        640: 100% ━━━━━━━━━━━━ 44/44 21.8it/s 2.0s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.4it/s 0.3s
                   all        155        105      0.432      0.514       0.36      0.132

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     21/180      2.69G      1.609      2.003      1.885         16        640: 100% ━━━━━━━━━━━━ 44/44 21.1it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.1it/s 0.3s
                   all        155        105      0.313       0.59      0.304      0.118

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     22/180      2.71G      1.562      1.943      1.832         20        640: 100% ━━━━━━━━━━━━ 44/44 21.2it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.1it/s 0.2s
                   all        155        105       0.45       0.61      0.507      0.222

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     23/180      2.71G      1.619      1.984      1.883         22        640: 100% ━━━━━━━━━━━━ 44/44 21.5it/s 2.0s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.8it/s 0.3s
                   all        155        105     0.0818      0.343     0.0605     0.0165

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     24/180      2.71G      1.476      1.886       1.79         11        640: 100% ━━━━━━━━━━━━ 44/44 21.5it/s 2.0s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.6it/s 0.2s
                   all        155        105      0.415      0.433      0.347       0.14

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     25/180      2.71G       1.58      1.908      1.842         16        640: 100% ━━━━━━━━━━━━ 44/44 20.4it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.5it/s 0.3s
                   all        155        105      0.346      0.624      0.326      0.126

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     26/180      2.71G       1.58      1.935      1.818         18        640: 100% ━━━━━━━━━━━━ 44/44 20.2it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 15.6it/s 0.3s
                   all        155        105      0.389       0.63      0.443      0.198

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     27/180      2.71G      1.435      1.801      1.768         17        640: 100% ━━━━━━━━━━━━ 44/44 19.9it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.1it/s 0.3s
                   all        155        105      0.493       0.59      0.461      0.194

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     28/180      2.71G       1.47      1.904      1.786         14        640: 100% ━━━━━━━━━━━━ 44/44 20.8it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.4it/s 0.3s
                   all        155        105      0.469      0.438      0.379      0.138

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     29/180      2.71G      1.506      1.888      1.807         16        640: 100% ━━━━━━━━━━━━ 44/44 21.0it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.1it/s 0.2s
                   all        155        105       0.47        0.6      0.486       0.23

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     30/180      2.71G      1.471      1.799      1.764         19        640: 100% ━━━━━━━━━━━━ 44/44 20.8it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.5it/s 0.3s
                   all        155        105      0.514      0.638      0.541      0.285

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     31/180      2.71G       1.49      1.779      1.786         21        640: 100% ━━━━━━━━━━━━ 44/44 21.7it/s 2.0s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 17.4it/s 0.3s
                   all        155        105      0.569      0.324      0.369      0.154

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     32/180      2.71G      1.464      1.744      1.763         12        640: 100% ━━━━━━━━━━━━ 44/44 21.3it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.9it/s 0.3s
                   all        155        105      0.554      0.592      0.525      0.242

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     33/180      2.71G      1.426       1.74      1.727         12        640: 100% ━━━━━━━━━━━━ 44/44 21.7it/s 2.0s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.2it/s 0.2s
                   all        155        105      0.564      0.514      0.558      0.261

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     34/180      2.71G      1.446      1.751      1.744         19        640: 100% ━━━━━━━━━━━━ 44/44 21.0it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.7it/s 0.3s
                   all        155        105      0.601      0.524      0.557      0.246

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     35/180      2.71G      1.474      1.739      1.744         12        640: 100% ━━━━━━━━━━━━ 44/44 20.0it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 17.1it/s 0.3s
                   all        155        105      0.505      0.633      0.513      0.249

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     36/180      2.71G      1.459       1.74      1.735         28        640: 100% ━━━━━━━━━━━━ 44/44 20.9it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.3it/s 0.2s
                   all        155        105       0.45      0.495      0.424      0.215

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     37/180      2.71G      1.412      1.708      1.714         15        640: 100% ━━━━━━━━━━━━ 44/44 20.9it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.0it/s 0.2s
                   all        155        105      0.659      0.627      0.644      0.303

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     38/180      2.71G      1.331      1.607       1.67         21        640: 100% ━━━━━━━━━━━━ 44/44 19.4it/s 2.3s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.3it/s 0.3s
                   all        155        105      0.477      0.638      0.504      0.269

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     39/180      2.71G      1.521      1.778      1.774         14        640: 100% ━━━━━━━━━━━━ 44/44 20.2it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.2it/s 0.3s
                   all        155        105      0.529      0.543      0.482      0.209

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     40/180      2.71G      1.305      1.676      1.646         14        640: 100% ━━━━━━━━━━━━ 44/44 21.1it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.4it/s 0.3s
                   all        155        105      0.697      0.638      0.683      0.336

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     41/180      2.71G       1.41      1.684      1.701         19        640: 100% ━━━━━━━━━━━━ 44/44 21.3it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.9it/s 0.3s
                   all        155        105      0.585      0.698      0.639      0.304

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     42/180      2.71G       1.37      1.535      1.678         21        640: 100% ━━━━━━━━━━━━ 44/44 21.1it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.9it/s 0.3s
                   all        155        105      0.612      0.533      0.526      0.292

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     43/180      2.71G      1.367      1.611      1.665         15        640: 100% ━━━━━━━━━━━━ 44/44 21.1it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 17.4it/s 0.3s
                   all        155        105      0.507      0.538      0.528      0.218

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     44/180      2.71G      1.331      1.566      1.658         23        640: 100% ━━━━━━━━━━━━ 44/44 21.0it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.7it/s 0.2s
                   all        155        105      0.534       0.61      0.596      0.287

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     45/180      2.71G      1.336      1.596      1.643         18        640: 100% ━━━━━━━━━━━━ 44/44 21.7it/s 2.0s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 17.4it/s 0.3s
                   all        155        105      0.542      0.609      0.571      0.291

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     46/180      2.71G      1.365      1.586      1.666         22        640: 100% ━━━━━━━━━━━━ 44/44 22.0it/s 2.0s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.6it/s 0.2s
                   all        155        105       0.72       0.59      0.599      0.287

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     47/180      2.71G        1.4      1.617      1.699         10        640: 100% ━━━━━━━━━━━━ 44/44 20.4it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.4it/s 0.2s
                   all        155        105      0.662        0.6      0.572      0.256

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     48/180      2.71G      1.361      1.598      1.659         18        640: 100% ━━━━━━━━━━━━ 44/44 20.3it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.1it/s 0.3s
                   all        155        105      0.628      0.743      0.654      0.321

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     49/180      2.71G      1.354      1.595      1.648         19        640: 100% ━━━━━━━━━━━━ 44/44 19.9it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.5it/s 0.3s
                   all        155        105      0.705      0.686      0.682       0.35

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     50/180      2.71G      1.253      1.541      1.604         16        640: 100% ━━━━━━━━━━━━ 44/44 21.2it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 16.5it/s 0.3s
                   all        155        105      0.565      0.648      0.571      0.272

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     51/180      2.71G      1.345      1.608      1.638         39        640: 100% ━━━━━━━━━━━━ 44/44 20.2it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.4it/s 0.3s
                   all        155        105      0.618      0.667      0.647      0.314

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     52/180      2.71G      1.304      1.498      1.603         27        640: 100% ━━━━━━━━━━━━ 44/44 19.9it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.4it/s 0.3s
                   all        155        105      0.657      0.581      0.596      0.315

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     53/180      2.71G      1.284      1.541      1.604         22        640: 100% ━━━━━━━━━━━━ 44/44 20.4it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.4it/s 0.2s
                   all        155        105      0.515      0.657      0.567       0.28

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     54/180      2.71G      1.306      1.536      1.621         37        640: 100% ━━━━━━━━━━━━ 44/44 21.3it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.2it/s 0.2s
                   all        155        105      0.601      0.533      0.526       0.27

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     55/180      2.71G      1.261      1.549      1.619         12        640: 100% ━━━━━━━━━━━━ 44/44 20.9it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.9it/s 0.3s
                   all        155        105       0.61      0.714       0.65      0.327

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     56/180      2.71G      1.279      1.499      1.614         17        640: 100% ━━━━━━━━━━━━ 44/44 20.0it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.2it/s 0.3s
                   all        155        105      0.625      0.581      0.583      0.319

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     57/180      2.71G      1.275      1.485      1.608         15        640: 100% ━━━━━━━━━━━━ 44/44 20.4it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.3it/s 0.3s
                   all        155        105      0.532      0.524      0.479      0.237

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     58/180      2.71G      1.262      1.506      1.583         18        640: 100% ━━━━━━━━━━━━ 44/44 20.8it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.7it/s 0.3s
                   all        155        105      0.541      0.667      0.619      0.305

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     59/180      2.71G      1.297      1.559        1.6         13        640: 100% ━━━━━━━━━━━━ 44/44 20.0it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.6it/s 0.2s
                   all        155        105      0.544      0.524      0.526       0.27

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     60/180      2.71G      1.288      1.507      1.642         18        640: 100% ━━━━━━━━━━━━ 44/44 19.7it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 16.9it/s 0.3s
                   all        155        105       0.55      0.667      0.591      0.305

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     61/180      2.71G      1.251      1.491      1.566         16        640: 100% ━━━━━━━━━━━━ 44/44 19.9it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.8it/s 0.3s
                   all        155        105      0.639      0.624      0.604      0.276

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     62/180      2.71G      1.325      1.502      1.643         10        640: 100% ━━━━━━━━━━━━ 44/44 20.3it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.6it/s 0.3s
                   all        155        105      0.664      0.724      0.706      0.364

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     63/180      2.71G      1.231       1.45      1.564         19        640: 100% ━━━━━━━━━━━━ 44/44 21.1it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 15.4it/s 0.3s
                   all        155        105      0.655      0.533      0.567      0.265

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     64/180      2.71G      1.251       1.46      1.589         15        640: 100% ━━━━━━━━━━━━ 44/44 20.5it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.1it/s 0.3s
                   all        155        105      0.631      0.648      0.617      0.311

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     65/180      2.71G      1.264      1.447      1.594         16        640: 100% ━━━━━━━━━━━━ 44/44 20.6it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 17.3it/s 0.3s
                   all        155        105      0.612      0.533      0.543      0.248

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     66/180      2.71G      1.216      1.423      1.581         17        640: 100% ━━━━━━━━━━━━ 44/44 20.3it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.4it/s 0.3s
                   all        155        105      0.734      0.724       0.73      0.413

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     67/180      2.71G      1.208      1.393      1.547         14        640: 100% ━━━━━━━━━━━━ 44/44 18.4it/s 2.4s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.5it/s 0.3s
                   all        155        105      0.738      0.724      0.718       0.38

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     68/180      2.71G      1.268      1.455      1.594         19        640: 100% ━━━━━━━━━━━━ 44/44 20.3it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.0it/s 0.3s
                   all        155        105      0.667      0.733      0.665      0.366

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     69/180      2.71G      1.241      1.414      1.563         15        640: 100% ━━━━━━━━━━━━ 44/44 19.5it/s 2.3s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.4it/s 0.3s
                   all        155        105      0.534      0.545       0.54      0.276

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     70/180      2.71G      1.322      1.489      1.595         13        640: 100% ━━━━━━━━━━━━ 44/44 19.5it/s 2.3s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.3it/s 0.3s
                   all        155        105      0.794      0.588      0.673      0.362

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     71/180      2.71G      1.195       1.45      1.582         19        640: 100% ━━━━━━━━━━━━ 44/44 20.0it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.0it/s 0.3s
                   all        155        105      0.686      0.552      0.638      0.338

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     72/180      2.71G      1.228      1.481      1.612         21        640: 100% ━━━━━━━━━━━━ 44/44 20.3it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.7it/s 0.3s
                   all        155        105      0.658      0.679      0.679      0.395

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     73/180      2.71G      1.274      1.497      1.592          9        640: 100% ━━━━━━━━━━━━ 44/44 20.7it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.0it/s 0.3s
                   all        155        105      0.651      0.745      0.711      0.358

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     74/180      2.71G      1.219      1.453      1.561         21        640: 100% ━━━━━━━━━━━━ 44/44 19.8it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.1it/s 0.3s
                   all        155        105      0.692      0.714      0.728      0.406

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     75/180      2.71G      1.235       1.37      1.578         17        640: 100% ━━━━━━━━━━━━ 44/44 19.9it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.1it/s 0.3s
                   all        155        105      0.644      0.654      0.672      0.352

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     76/180      2.71G       1.25        1.5      1.561         18        640: 100% ━━━━━━━━━━━━ 44/44 20.9it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 17.5it/s 0.3s
                   all        155        105      0.531      0.583      0.615      0.293

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     77/180      2.71G      1.213      1.452      1.569         25        640: 100% ━━━━━━━━━━━━ 44/44 19.9it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.5it/s 0.3s
                   all        155        105      0.739      0.705      0.741      0.408

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     78/180      2.72G      1.273      1.409       1.59         23        640: 100% ━━━━━━━━━━━━ 44/44 20.0it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.3it/s 0.2s
                   all        155        105      0.695      0.686      0.675      0.346

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     79/180      2.72G       1.15       1.41      1.531         27        640: 100% ━━━━━━━━━━━━ 44/44 20.3it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.9it/s 0.3s
                   all        155        105      0.664      0.657      0.687      0.375

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     80/180      2.72G      1.158      1.347      1.534         15        640: 100% ━━━━━━━━━━━━ 44/44 20.5it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 17.0it/s 0.3s
                   all        155        105      0.786      0.695      0.735      0.405

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     81/180      2.72G      1.281      1.456      1.596         16        640: 100% ━━━━━━━━━━━━ 44/44 20.6it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.6it/s 0.3s
                   all        155        105      0.689      0.648      0.682      0.427

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     82/180      2.72G       1.16      1.384      1.539         18        640: 100% ━━━━━━━━━━━━ 44/44 19.6it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 17.6it/s 0.3s
                   all        155        105      0.729      0.718      0.743      0.424

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     83/180      2.72G      1.226      1.407      1.576         12        640: 100% ━━━━━━━━━━━━ 44/44 20.1it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.1it/s 0.2s
                   all        155        105      0.609      0.629      0.615      0.358

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     84/180      2.72G      1.168      1.351      1.543         19        640: 100% ━━━━━━━━━━━━ 44/44 19.6it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.2it/s 0.3s
                   all        155        105      0.636      0.681      0.681      0.404

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     85/180      2.72G      1.148      1.333      1.514          9        640: 100% ━━━━━━━━━━━━ 44/44 20.8it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.2it/s 0.3s
                   all        155        105      0.732      0.677       0.69      0.337

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     86/180      2.72G      1.194      1.311       1.54         14        640: 100% ━━━━━━━━━━━━ 44/44 20.3it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 15.4it/s 0.3s
                   all        155        105       0.66      0.703      0.637      0.329

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     87/180      2.72G      1.174        1.4      1.551         19        640: 100% ━━━━━━━━━━━━ 44/44 19.6it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.3it/s 0.3s
                   all        155        105      0.753      0.666      0.729      0.428

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     88/180      2.72G      1.148      1.376      1.513         21        640: 100% ━━━━━━━━━━━━ 44/44 20.5it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.6it/s 0.3s
                   all        155        105      0.647      0.594      0.618      0.362

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     89/180      2.72G      1.181      1.392       1.56         15        640: 100% ━━━━━━━━━━━━ 44/44 20.3it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.7it/s 0.3s
                   all        155        105      0.726      0.695      0.735      0.436

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     90/180      2.72G      1.151      1.366      1.527         20        640: 100% ━━━━━━━━━━━━ 44/44 20.1it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.4it/s 0.3s
                   all        155        105      0.673      0.762      0.719      0.395

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     91/180      2.72G       1.18      1.407      1.516         14        640: 100% ━━━━━━━━━━━━ 44/44 19.6it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.3it/s 0.3s
                   all        155        105      0.703        0.7      0.708       0.42

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     92/180      2.72G      1.186      1.341       1.55         20        640: 100% ━━━━━━━━━━━━ 44/44 19.2it/s 2.3s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.5it/s 0.3s
                   all        155        105       0.74      0.732      0.777      0.456

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     93/180      2.72G      1.123      1.287      1.513         14        640: 100% ━━━━━━━━━━━━ 44/44 20.1it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.2it/s 0.2s
                   all        155        105      0.739      0.724      0.765      0.488

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     94/180      2.72G      1.156      1.295      1.513         11        640: 100% ━━━━━━━━━━━━ 44/44 19.3it/s 2.3s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.0it/s 0.2s
                   all        155        105        0.7       0.71      0.729      0.434

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     95/180      2.72G      1.155      1.256      1.508         19        640: 100% ━━━━━━━━━━━━ 44/44 19.7it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.2it/s 0.2s
                   all        155        105      0.651      0.695      0.701      0.434

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     96/180      2.72G      1.154      1.273      1.494         19        640: 100% ━━━━━━━━━━━━ 44/44 20.5it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 21.0it/s 0.2s
                   all        155        105      0.689      0.648      0.696      0.419

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     97/180      2.72G      1.173      1.298      1.521         12        640: 100% ━━━━━━━━━━━━ 44/44 20.5it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.9it/s 0.3s
                   all        155        105      0.764      0.667      0.743       0.44

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     98/180      2.72G      1.148      1.326      1.508         11        640: 100% ━━━━━━━━━━━━ 44/44 19.9it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 15.7it/s 0.3s
                   all        155        105       0.74      0.829      0.795      0.483

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     99/180      2.72G       1.13      1.253      1.474         14        640: 100% ━━━━━━━━━━━━ 44/44 20.7it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 16.3it/s 0.3s
                   all        155        105      0.665        0.8      0.747       0.43

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
    100/180      2.72G      1.137      1.265      1.539         15        640: 100% ━━━━━━━━━━━━ 44/44 21.3it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.9it/s 0.3s
                   all        155        105      0.662      0.629      0.662       0.38

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
    101/180      2.72G       1.15      1.258      1.521         11        640: 100% ━━━━━━━━━━━━ 44/44 19.5it/s 2.3s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.5it/s 0.3s
                   all        155        105      0.658       0.66        0.7      0.405

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
    102/180      2.72G       1.14      1.295      1.497         19        640: 100% ━━━━━━━━━━━━ 44/44 20.6it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.0it/s 0.3s
                   all        155        105       0.71      0.695      0.674      0.365

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
    103/180      2.72G      1.087      1.235      1.456         24        640: 100% ━━━━━━━━━━━━ 44/44 20.6it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.0it/s 0.3s
                   all        155        105      0.793       0.79      0.775      0.452

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
    104/180      2.72G      1.058      1.266      1.464         16        640: 100% ━━━━━━━━━━━━ 44/44 20.3it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.9it/s 0.3s
                   all        155        105      0.662      0.762      0.739      0.462

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
    105/180      2.72G      1.109      1.288      1.501         20        640: 100% ━━━━━━━━━━━━ 44/44 20.4it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 15.5it/s 0.3s
                   all        155        105      0.653      0.682       0.67      0.393

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
    106/180      2.72G      1.103      1.271      1.462         23        640: 100% ━━━━━━━━━━━━ 44/44 20.7it/s 2.1s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.2it/s 0.3s
                   all        155        105      0.769      0.761      0.805       0.47

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
    107/180      2.72G      1.123      1.242      1.483         13        640: 100% ━━━━━━━━━━━━ 44/44 20.3it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 17.6it/s 0.3s
                   all        155        105      0.762      0.733      0.737      0.408

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
    108/180      2.72G      1.141      1.231        1.5         25        640: 100% ━━━━━━━━━━━━ 44/44 19.9it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.0it/s 0.3s
                   all        155        105      0.724      0.695      0.759      0.429

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
    109/180      2.72G      1.118      1.278      1.482         18        640: 100% ━━━━━━━━━━━━ 44/44 18.9it/s 2.3s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.0it/s 0.3s
                   all        155        105      0.706        0.6      0.666      0.399

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
    110/180      2.72G      1.054      1.226      1.459         17        640: 100% ━━━━━━━━━━━━ 44/44 19.7it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 20.0it/s 0.3s
                   all        155        105      0.731      0.726      0.766      0.466

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
    111/180      2.72G      1.155        1.3      1.496         24        640: 100% ━━━━━━━━━━━━ 44/44 20.0it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.6it/s 0.3s
                   all        155        105      0.798      0.638      0.719      0.433

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
    112/180      2.72G      1.103      1.218      1.469         21        640: 100% ━━━━━━━━━━━━ 44/44 20.4it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 18.6it/s 0.3s
                   all        155        105      0.685      0.724      0.748      0.434

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
    113/180      2.72G      1.143      1.239      1.502         15        640: 100% ━━━━━━━━━━━━ 44/44 19.9it/s 2.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 19.8it/s 0.3s
                   all        155        105      0.588        0.6      0.589       0.32
EarlyStopping: Training stopped early as no improvement observed in last 20 epochs. Best results observed at epoch 93, best model saved as best.pt.
To update EarlyStopping(patience=20) pass a new patience value, i.e. `patience=300` or use `patience=0` to disable EarlyStopping.

113 epochs completed in 0.093 hours.
Optimizer stripped from /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/runs/regularize/regularize_run_1/weights/last.pt, 6.3MB
Optimizer stripped from /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/runs/regularize/regularize_run_1/weights/best.pt, 6.3MB

Validating /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/runs/regularize/regularize_run_1/weights/best.pt...
Ultralytics 8.3.252 🚀 Python-3.12.12 torch-2.9.0+cu126 CUDA:0 (NVIDIA H100 80GB HBM3, 81224MiB)
Model summary (fused): 72 layers, 3,005,843 parameters, 0 gradients, 8.1 GFLOPs
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 4.9it/s 1.0s
                   all        155        105      0.791      0.657      0.764      0.509
Speed: 0.1ms preprocess, 2.8ms inference, 0.0ms loss, 0.6ms postprocess per image
Results saved to /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/runs/regularize/regularize_run_1
In [ ]:
#  --- CONFIGURATION ---
DRIVE_MODEL_DIR = './yolov8_results/'
RUNS_DIR = 'runs/detect/runs/regularize/regularize_run_1'
BEST_WEIGHTS_FILENAME = 'best_regularize_1.pt'
OUTPUT_WEIGHTS_NAME = 'weights_regularize_1.pt'

os.makedirs(DRIVE_MODEL_DIR, exist_ok=True)
In [ ]:
save_weights_to_drive(RUNS_DIR, DRIVE_MODEL_DIR, BEST_WEIGHTS_FILENAME, OUTPUT_WEIGHTS_NAME)
✅ Best weights saved: best_regularize_1.pt
✅ Last weights saved: weights_regularize_1.pt
In [ ]:
import pandas as pd
import matplotlib.pyplot as plt

# Run 1
visualize_training_results(RUNS_DIR)
No description has been provided for this image
============================================================
📈 DETAILED TRAINING STATISTICS
============================================================
Total Epochs: 113

🎯 Best mAP50: 0.8049 (Epoch 105)
🎯 Best mAP50-95: 0.4882 (Epoch 92)

📊 Final Metrics:
   mAP50: 0.5893
   mAP50-95: 0.3196
   Precision: 0.5885
   Recall: 0.6000

⚠️  Possible overfitting detected: mAP50 dropped by 0.216
============================================================

"Class Loss" measures how well the model identifies what an object is (Santa vs. Background). Initially, the model has no idea what a Santa looks like, so it makes huge errors. Class Loss keeps falling after DFL stabilizes around epoch 80, but mAP stays somewhat flat, which could mean that the model is starting to memorize pixel patterns rather than learning features. However, the model is still struggling a bit with localization (higher than optimal box loss) as well as with classification (higher than desired class loss).

The mAP curves show a strong upward trend, reaching a peak of 0.805 for mAP50, which is significantly higher and more stable than your overfitted run. While there are minor fluctuations, the overall growth indicates the model is successfully generalizing its knowledge to the validation set.

Precision and recall converge toward each other, meaning the model is becoming equally good at avoiding false positives and finding all Santas, but there is room for imrpovement.

Total loss curve demonstrates stable optimization process, no erratic spikes.

Early stopping here might not be the best decision, since the training is a bit unstable. We could use optimizer and also ensure smoother training with `momentum'=0.9 or try 'warmup_epochs', where we gradually increase learning rate in the intial epochs (our smaller dataset is less forgiving of a bad start). We can tune this parameters in 04 Notebook.

In Overfitting check, the generalization gap is minimized.

In [ ]:
# Run diagnostics
df = diagnose_training_results('runs/detect/runs/regularize/regularize_run_1')
================================================================================
🔍 TRAINING DIAGNOSTICS
================================================================================

📈 FINAL METRICS (Epoch 113):
   mAP50:     0.5893
   mAP50-95:  0.3196
   Precision: 0.5885
   Recall:    0.6000

🎯 BEST METRICS (Epoch 106):
   mAP50:     0.8049
   mAP50-95:  0.4696
   Precision: 0.7691
   Recall:    0.7613

📉 LOSS VALUES:
   Final Box Loss:   1.1428
   Final Class Loss: 1.2392
   Final DFL Loss:   1.5019

⚠️  POTENTIAL ISSUES:
   ⚠️  High box loss - Struggling with localization
   ⚠️  High class loss - Struggling with classification
   ⚠️  Overfitting detected - mAP dropped 0.216

================================================================================

Checking the model performance on an unseen test set¶

In [ ]:
# On a TEST SET
# Run validation on the test split
model = YOLO('./yolov8_results/best_regularize_1.pt')
metrics = model.val(data=dataset_yaml, split='test')
print(f"Test results saved to: {metrics.save_dir}")

# Precision, recall, and mAP results
precision = metrics.results_dict['metrics/precision(B)']
recall = metrics.results_dict['metrics/recall(B)']
mAP50 = metrics.results_dict['metrics/mAP50(B)']
mAP50_95 = metrics.results_dict['metrics/mAP50-95(B)']

print(f"Precision: {precision:.2f}")
print(f"Recall: {recall:.2f}")
print(f"mAP50: {mAP50:.2f}")
print(f"mAP50-95: {mAP50_95:.2f}")
Ultralytics 8.3.252 🚀 Python-3.12.12 torch-2.9.0+cu126 CUDA:0 (NVIDIA A100-SXM4-40GB, 40507MiB)
Model summary (fused): 72 layers, 11,125,971 parameters, 0 gradients, 28.4 GFLOPs
val: Fast image access ✅ (ping: 0.6±0.2 ms, read: 23.0±5.9 MB/s, size: 28.3 KB)
val: Scanning /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/Santa-10/test/labels.cache... 95 images, 42 backgrounds, 0 corrupt: 100% ━━━━━━━━━━━━ 95/95 36.2Mit/s 0.0s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 6/6 3.6it/s 1.7s
                   all         95         53      0.727      0.803      0.838      0.507
Speed: 2.3ms preprocess, 1.7ms inference, 0.0ms loss, 1.9ms postprocess per image
Results saved to /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/val17
Test results saved to: /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/val17
Precision: 0.73
Recall: 0.80
mAP50: 0.84
mAP50-95: 0.51
In [ ]:
%cd '/content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC'
/content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC
In [ ]:
from IPython.display import Image, display
import matplotlib.pyplot as plt

# F1 curve
f1_path = os.path.join('runs/detect/val17', 'BoxF1_curve.png')
display(Image(filename=f1_path, width=600))

# Precision Recall  curve
pr_path = os.path.join('runs/detect/val17', 'BoxPR_curve.png')
display(Image(filename=pr_path, width=600))

# Confusion matrix
cm_path = os.path.join('runs/detect/val17', 'confusion_matrix.png')
display(Image(filename=cm_path, width=600))
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image

F1 score penalizes you if you miss Santas (low Recall) OR if you see them where they don't exist (low Precision). For a small dataset, peak at 0.805 is a good result, but it is true we deal with only one class. Optimal threshold seems to be around 0.5. If we go lower, we catch more Santas, but also more false alarms.

Precision-Recall (PR) Curve indicates model robustness. A model that reaches closer to the top-right corner is superior, because it is precise about the Santas it identifies.

Since we want to optimize fo less false negatives, we need to be OK with lower precision (after all we optimize for higher recall). This we can control with lowering the confidence threshold.

In [ ]:
def show_image_results(path, batch=0):
    """Side-by-side view of Ground Truth vs Predictions."""
    f_lab = os.path.join(path, f'val_batch{batch}_labels.jpg')
    f_pre = os.path.join(path, f'val_batch{batch}_pred.jpg')

    if not os.path.exists(f_lab):
        return print(f"Missing files in {path}")

    fig, ax = plt.subplots(1, 2, figsize=(18, 9))
    ax[0].imshow(PILImage.open(f_lab))
    ax[0].set_title("Labels (Actual)")
    ax[1].imshow(PILImage.open(f_pre))
    ax[1].set_title("Predictions (Model)")

    for a in ax: a.axis('off')
    plt.tight_layout()
    plt.show()

show_image_results('runs/detect/val17', batch=0)
show_image_results('runs/detect/val17', batch=2)

The visual inspection reveals that some false negatives/positives might be the consequence of the noise in annotation. Firstly, the definition of what is a Santa would need to be revisited and addtional instances shoud be annotated. Secondly, some bounding boxes (not visible here) would need to be more narrow, containing less superfluous pixels.

Run 2: Small YOLO¶

In [ ]:
# Load overfitted weights instead of pretrained
# Best model from before, YOLO s
model = YOLO('models_cache/yolov8s.pt')

# Use even lighter regularization, finetune_from_overfit
regularized_config_2 = {
    'data': dataset_yaml,
    'epochs': 150,
    'batch': 16,
    'patience': 25,
    'device': 0,
    'augment': True,
    'degrees': 5.0,
    'translate': 0.1,
    'scale': 0.3,
    'fliplr': 0.5,
    'mosaic': 0.3,           # Very light mosaic
    'mixup': 0.0,
    'lr0': 0.001,            # a bit stronger L2
    'lrf': 0.1,
    'momentum': 0.937,
    'weight_decay': 0.008,
    'dropout': 0.2,
    'optimizer': 'Adam',
    'verbose': True,
    'save': True,
    'project': 'runs/regularize',
    'name': 'regularize_run_2',
    'val': True,
    'exist_ok': True
}
In [ ]:
# # --- RUN 2
# --- TRAIN ---
print("🚀 Starting training (designed NOT to overfit) ...")
results = model.train(**regularized_config_2)
🚀 Starting training (designed NOT to overfit) ...
Ultralytics 8.3.252 🚀 Python-3.12.12 torch-2.9.0+cu126 CUDA:0 (NVIDIA A100-SXM4-40GB, 40507MiB)
engine/trainer: agnostic_nms=False, amp=True, augment=True, auto_augment=randaugment, batch=16, bgr=0.0, box=7.5, cache=False, cfg=None, classes=None, close_mosaic=10, cls=0.5, compile=False, conf=None, copy_paste=0.0, copy_paste_mode=flip, cos_lr=True, cutmix=0.0, data=Santa-10/data.yaml, degrees=5.0, deterministic=True, device=0, dfl=1.5, dnn=False, dropout=0.0, dynamic=False, embed=None, epochs=150, erasing=0.4, exist_ok=True, fliplr=0.5, flipud=0.0, format=torchscript, fraction=1.0, freeze=None, half=False, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, imgsz=512, int8=False, iou=0.7, keras=False, kobj=1.0, line_width=None, lr0=0.001, lrf=0.1, mask_ratio=4, max_det=300, mixup=0.0, mode=train, model=yolov8_results/best_overfit_4.pt, momentum=0.937, mosaic=0.3, multi_scale=False, name=regularize_run_2, nbs=64, nms=False, opset=None, optimize=False, optimizer=SGD, overlap_mask=True, patience=25, perspective=0.0, plots=True, pose=12.0, pretrained=True, profile=False, project=runs/regularize, rect=False, resume=False, retina_masks=False, save=True, save_conf=False, save_crop=False, save_dir=/content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/runs/regularize/regularize_run_2, save_frames=False, save_json=False, save_period=-1, save_txt=False, scale=0.3, seed=0, shear=0.0, show=False, show_boxes=True, show_conf=True, show_labels=True, simplify=True, single_cls=False, source=None, split=val, stream_buffer=False, task=detect, time=None, tracker=botsort.yaml, translate=0.1, val=True, verbose=True, vid_stride=1, visualize=False, warmup_bias_lr=0.1, warmup_epochs=3.0, warmup_momentum=0.8, weight_decay=5e-05, workers=8, workspace=None

                   from  n    params  module                                       arguments                     
  0                  -1  1       928  ultralytics.nn.modules.conv.Conv             [3, 32, 3, 2]                 
  1                  -1  1     18560  ultralytics.nn.modules.conv.Conv             [32, 64, 3, 2]                
  2                  -1  1     29056  ultralytics.nn.modules.block.C2f             [64, 64, 1, True]             
  3                  -1  1     73984  ultralytics.nn.modules.conv.Conv             [64, 128, 3, 2]               
  4                  -1  2    197632  ultralytics.nn.modules.block.C2f             [128, 128, 2, True]           
  5                  -1  1    295424  ultralytics.nn.modules.conv.Conv             [128, 256, 3, 2]              
  6                  -1  2    788480  ultralytics.nn.modules.block.C2f             [256, 256, 2, True]           
  7                  -1  1   1180672  ultralytics.nn.modules.conv.Conv             [256, 512, 3, 2]              
  8                  -1  1   1838080  ultralytics.nn.modules.block.C2f             [512, 512, 1, True]           
  9                  -1  1    656896  ultralytics.nn.modules.block.SPPF            [512, 512, 5]                 
 10                  -1  1         0  torch.nn.modules.upsampling.Upsample         [None, 2, 'nearest']          
 11             [-1, 6]  1         0  ultralytics.nn.modules.conv.Concat           [1]                           
 12                  -1  1    591360  ultralytics.nn.modules.block.C2f             [768, 256, 1]                 
 13                  -1  1         0  torch.nn.modules.upsampling.Upsample         [None, 2, 'nearest']          
 14             [-1, 4]  1         0  ultralytics.nn.modules.conv.Concat           [1]                           
 15                  -1  1    148224  ultralytics.nn.modules.block.C2f             [384, 128, 1]                 
 16                  -1  1    147712  ultralytics.nn.modules.conv.Conv             [128, 128, 3, 2]              
 17            [-1, 12]  1         0  ultralytics.nn.modules.conv.Concat           [1]                           
 18                  -1  1    493056  ultralytics.nn.modules.block.C2f             [384, 256, 1]                 
 19                  -1  1    590336  ultralytics.nn.modules.conv.Conv             [256, 256, 3, 2]              
 20             [-1, 9]  1         0  ultralytics.nn.modules.conv.Concat           [1]                           
 21                  -1  1   1969152  ultralytics.nn.modules.block.C2f             [768, 512, 1]                 
 22        [15, 18, 21]  1   2116435  ultralytics.nn.modules.head.Detect           [1, [128, 256, 512]]          
Model summary: 129 layers, 11,135,987 parameters, 11,135,971 gradients, 28.6 GFLOPs

Transferred 355/355 items from pretrained weights
Freezing layer 'model.22.dfl.conv.weight'
AMP: running Automatic Mixed Precision (AMP) checks...
AMP: checks passed ✅
train: Fast image access ✅ (ping: 0.5±0.2 ms, read: 21.0±13.7 MB/s, size: 27.0 KB)
train: Scanning /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/Santa-10/train/labels... 700 images, 327 backgrounds, 0 corrupt: 100% ━━━━━━━━━━━━ 700/700 148.2it/s 4.7s
train: New cache created: /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/Santa-10/train/labels.cache
albumentations: Blur(p=0.01, blur_limit=(3, 7)), MedianBlur(p=0.01, blur_limit=(3, 7)), ToGray(p=0.01, method='weighted_average', num_output_channels=3), CLAHE(p=0.01, clip_limit=(1.0, 4.0), tile_grid_size=(8, 8))
val: Fast image access ✅ (ping: 1.5±1.1 ms, read: 5.2±6.1 MB/s, size: 28.7 KB)
val: Scanning /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/Santa-10/valid/labels... 155 images, 54 backgrounds, 0 corrupt: 100% ━━━━━━━━━━━━ 155/155 157.3it/s 1.0s
val: New cache created: /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/Santa-10/valid/labels.cache
Plotting labels to /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/runs/regularize/regularize_run_2/labels.jpg... 
optimizer: SGD(lr=0.001, momentum=0.937) with parameter groups 57 weight(decay=0.0), 64 weight(decay=5e-05), 63 bias(decay=0.0)
Image sizes 512 train, 512 val
Using 8 dataloader workers
Logging results to /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/runs/regularize/regularize_run_2
Starting training for 150 epochs...

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      1/150      3.12G      1.435      2.845      1.835         33        512: 100% ━━━━━━━━━━━━ 44/44 8.5it/s 5.2s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 8.2it/s 0.6s
                   all        155        105      0.676      0.619      0.643      0.421

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      2/150      3.15G      1.206      1.993      1.619          6        512: 100% ━━━━━━━━━━━━ 44/44 11.3it/s 3.9s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 9.9it/s 0.5s
                   all        155        105      0.564      0.705      0.655       0.44

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      3/150      3.17G      1.099      1.594      1.537          6        512: 100% ━━━━━━━━━━━━ 44/44 11.5it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 9.6it/s 0.5s
                   all        155        105      0.657      0.724      0.723      0.478

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      4/150      3.17G     0.9899      1.348       1.44         10        512: 100% ━━━━━━━━━━━━ 44/44 11.1it/s 3.9s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 8.9it/s 0.6s
                   all        155        105      0.737      0.719      0.771       0.51

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      5/150       3.2G     0.9165      1.108      1.388         12        512: 100% ━━━━━━━━━━━━ 44/44 12.0it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.3it/s 0.5s
                   all        155        105      0.764      0.743      0.807      0.558

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      6/150       3.2G     0.8614       1.01      1.339         10        512: 100% ━━━━━━━━━━━━ 44/44 11.8it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 9.6it/s 0.5s
                   all        155        105      0.725       0.78      0.791      0.562

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      7/150       3.2G     0.8596      0.985      1.336          9        512: 100% ━━━━━━━━━━━━ 44/44 11.5it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.7it/s 0.5s
                   all        155        105      0.789      0.821      0.836      0.607

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      8/150       3.2G     0.8281     0.9452       1.28          7        512: 100% ━━━━━━━━━━━━ 44/44 11.9it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.4it/s 0.5s
                   all        155        105       0.87      0.761      0.857      0.636

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
      9/150       3.2G     0.7746     0.8104      1.249          9        512: 100% ━━━━━━━━━━━━ 44/44 11.5it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.4it/s 0.5s
                   all        155        105      0.774      0.849      0.861      0.624

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     10/150       3.2G     0.7553     0.8286      1.248         13        512: 100% ━━━━━━━━━━━━ 44/44 10.9it/s 4.0s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.4it/s 0.5s
                   all        155        105      0.781      0.819       0.82      0.592

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     11/150       3.2G      0.744     0.7578      1.231          8        512: 100% ━━━━━━━━━━━━ 44/44 11.5it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.3it/s 0.5s
                   all        155        105      0.866      0.802      0.852      0.631

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     12/150       3.2G     0.7919     0.8855      1.241          8        512: 100% ━━━━━━━━━━━━ 44/44 11.3it/s 3.9s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.2it/s 0.5s
                   all        155        105       0.83       0.81      0.859      0.642

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     13/150       3.2G     0.7249     0.7761      1.233          3        512: 100% ━━━━━━━━━━━━ 44/44 12.3it/s 3.6s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.1it/s 0.5s
                   all        155        105      0.795      0.848      0.867      0.643

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     14/150       3.2G     0.7508     0.7291       1.22          5        512: 100% ━━━━━━━━━━━━ 44/44 11.9it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 9.9it/s 0.5s
                   all        155        105      0.812      0.821      0.847      0.624

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     15/150       3.2G     0.7172     0.7435      1.193         10        512: 100% ━━━━━━━━━━━━ 44/44 11.8it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 8.2it/s 0.6s
                   all        155        105      0.833      0.856      0.857      0.621

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     16/150       3.2G     0.7532     0.6875      1.222          6        512: 100% ━━━━━━━━━━━━ 44/44 11.8it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.4it/s 0.5s
                   all        155        105      0.844       0.81      0.832      0.621

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     17/150       3.2G     0.6876     0.6596       1.16          8        512: 100% ━━━━━━━━━━━━ 44/44 11.5it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.2it/s 0.5s
                   all        155        105      0.828      0.829      0.866      0.649

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     18/150       3.2G     0.7367      0.671       1.22         13        512: 100% ━━━━━━━━━━━━ 44/44 11.4it/s 3.9s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.2it/s 0.5s
                   all        155        105      0.873      0.724      0.858      0.621

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     19/150       3.2G     0.7059     0.6419       1.21          8        512: 100% ━━━━━━━━━━━━ 44/44 12.1it/s 3.6s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.9it/s 0.5s
                   all        155        105      0.823      0.838      0.879      0.636

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     20/150       3.2G     0.7019     0.6062      1.181          8        512: 100% ━━━━━━━━━━━━ 44/44 11.6it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 9.4it/s 0.5s
                   all        155        105       0.87      0.771      0.855      0.639

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     21/150       3.2G     0.6386      0.565      1.136          8        512: 100% ━━━━━━━━━━━━ 44/44 11.8it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.4it/s 0.5s
                   all        155        105      0.846      0.819       0.87      0.654

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     22/150       3.2G     0.6687     0.5771      1.145          7        512: 100% ━━━━━━━━━━━━ 44/44 12.1it/s 3.6s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.3it/s 0.5s
                   all        155        105       0.86      0.816      0.873      0.647

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     23/150       3.2G     0.6901     0.6227      1.178         13        512: 100% ━━━━━━━━━━━━ 44/44 11.4it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.6it/s 0.5s
                   all        155        105      0.853      0.828      0.848      0.595

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     24/150       3.2G     0.6696     0.5857       1.15          7        512: 100% ━━━━━━━━━━━━ 44/44 11.7it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.4it/s 0.5s
                   all        155        105      0.777       0.81      0.817      0.596

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     25/150       3.2G     0.6884     0.5846      1.164          7        512: 100% ━━━━━━━━━━━━ 44/44 11.9it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 9.6it/s 0.5s
                   all        155        105      0.825      0.781      0.824      0.599

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     26/150       3.2G     0.6674     0.5969      1.147          6        512: 100% ━━━━━━━━━━━━ 44/44 11.5it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.5it/s 0.5s
                   all        155        105      0.796      0.782      0.837       0.62

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     27/150       3.2G     0.6107     0.5306      1.125          9        512: 100% ━━━━━━━━━━━━ 44/44 11.7it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.0it/s 0.5s
                   all        155        105      0.827      0.857      0.871      0.644

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     28/150       3.2G     0.6726     0.5525      1.152         10        512: 100% ━━━━━━━━━━━━ 44/44 11.4it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 9.2it/s 0.5s
                   all        155        105      0.804      0.862      0.846      0.617

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     29/150       3.2G     0.6767     0.5284      1.163         11        512: 100% ━━━━━━━━━━━━ 44/44 11.8it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 11.0it/s 0.5s
                   all        155        105       0.83      0.857      0.847      0.622

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     30/150       3.2G     0.6811     0.5462       1.15          9        512: 100% ━━━━━━━━━━━━ 44/44 12.3it/s 3.6s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.2it/s 0.5s
                   all        155        105       0.85      0.819      0.854       0.66

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     31/150       3.2G     0.6403     0.5241      1.143          7        512: 100% ━━━━━━━━━━━━ 44/44 11.3it/s 3.9s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.9it/s 0.5s
                   all        155        105      0.798      0.867      0.855      0.663

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     32/150       3.2G      0.601      0.529      1.086          7        512: 100% ━━━━━━━━━━━━ 44/44 12.0it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 11.3it/s 0.4s
                   all        155        105      0.823      0.797      0.851      0.645

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     33/150       3.2G     0.6501     0.5437      1.125         17        512: 100% ━━━━━━━━━━━━ 44/44 12.1it/s 3.6s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 8.6it/s 0.6s
                   all        155        105      0.839      0.792      0.879       0.65

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     34/150       3.2G     0.6385     0.5051       1.12         12        512: 100% ━━━━━━━━━━━━ 44/44 11.3it/s 3.9s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.4it/s 0.5s
                   all        155        105      0.854      0.829      0.859      0.634

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     35/150       3.2G     0.6639     0.5337      1.147          8        512: 100% ━━━━━━━━━━━━ 44/44 11.9it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.7it/s 0.5s
                   all        155        105       0.84      0.848      0.881      0.669

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     36/150       3.2G      0.671     0.5376      1.141         11        512: 100% ━━━━━━━━━━━━ 44/44 11.7it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 9.9it/s 0.5s
                   all        155        105      0.864      0.848       0.89      0.674

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     37/150       3.2G     0.5948     0.4657      1.087         10        512: 100% ━━━━━━━━━━━━ 44/44 11.5it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.6it/s 0.5s
                   all        155        105      0.844      0.874      0.892      0.686

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     38/150       3.2G     0.5827      0.482      1.091          8        512: 100% ━━━━━━━━━━━━ 44/44 11.9it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 11.0it/s 0.5s
                   all        155        105      0.795      0.887      0.866      0.667

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     39/150       3.2G     0.6105     0.4953      1.099         13        512: 100% ━━━━━━━━━━━━ 44/44 11.8it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 9.5it/s 0.5s
                   all        155        105      0.812      0.895      0.865      0.661

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     40/150      3.21G       0.59     0.4597      1.105         10        512: 100% ━━━━━━━━━━━━ 44/44 11.7it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.8it/s 0.5s
                   all        155        105      0.853      0.848      0.872      0.658

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     41/150      3.21G     0.6245     0.5171      1.105          7        512: 100% ━━━━━━━━━━━━ 44/44 11.6it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.6it/s 0.5s
                   all        155        105      0.898      0.848      0.876      0.645

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     42/150      3.21G     0.5823     0.4774      1.095          9        512: 100% ━━━━━━━━━━━━ 44/44 11.4it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.4it/s 0.5s
                   all        155        105      0.861      0.829      0.838      0.627

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     43/150      3.21G     0.5956     0.4669      1.102         13        512: 100% ━━━━━━━━━━━━ 44/44 12.2it/s 3.6s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.5it/s 0.5s
                   all        155        105      0.873      0.819      0.819      0.608

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     44/150      3.21G     0.6022     0.4797      1.108         10        512: 100% ━━━━━━━━━━━━ 44/44 11.8it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.1it/s 0.5s
                   all        155        105      0.817      0.895      0.859      0.636

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     45/150      3.21G     0.5916     0.5103      1.109         10        512: 100% ━━━━━━━━━━━━ 44/44 11.3it/s 3.9s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.4it/s 0.5s
                   all        155        105      0.847      0.848      0.872       0.65

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     46/150      3.21G     0.5883     0.4462      1.072          8        512: 100% ━━━━━━━━━━━━ 44/44 12.0it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.2it/s 0.5s
                   all        155        105      0.834      0.857      0.873      0.651

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     47/150      3.21G     0.6025     0.4831      1.091          9        512: 100% ━━━━━━━━━━━━ 44/44 11.8it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.2it/s 0.5s
                   all        155        105      0.834      0.857      0.859      0.647

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     48/150      3.21G     0.6188     0.4696      1.106         16        512: 100% ━━━━━━━━━━━━ 44/44 11.7it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.4it/s 0.5s
                   all        155        105      0.788      0.867      0.856      0.643

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     49/150      3.21G     0.5901     0.4575      1.117         10        512: 100% ━━━━━━━━━━━━ 44/44 11.7it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 11.1it/s 0.5s
                   all        155        105      0.874      0.781      0.811      0.609

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     50/150      3.21G     0.5522     0.4419      1.064         12        512: 100% ━━━━━━━━━━━━ 44/44 11.6it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.8it/s 0.5s
                   all        155        105      0.832      0.848       0.87      0.667

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     51/150      3.21G     0.5824      0.447      1.096         13        512: 100% ━━━━━━━━━━━━ 44/44 11.7it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 9.7it/s 0.5s
                   all        155        105      0.863      0.838      0.848      0.646

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     52/150      3.21G      0.544     0.4273      1.054         12        512: 100% ━━━━━━━━━━━━ 44/44 12.0it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.6it/s 0.5s
                   all        155        105      0.867      0.876       0.87      0.664

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     53/150      3.21G     0.5696     0.4542       1.08         13        512: 100% ━━━━━━━━━━━━ 44/44 11.5it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 9.6it/s 0.5s
                   all        155        105      0.894      0.806      0.867      0.661

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     54/150      3.21G     0.5522     0.4511       1.09         12        512: 100% ━━━━━━━━━━━━ 44/44 11.4it/s 3.9s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.6it/s 0.5s
                   all        155        105      0.878      0.848      0.875      0.674

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     55/150      3.21G     0.5615     0.4552      1.084          6        512: 100% ━━━━━━━━━━━━ 44/44 12.0it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.8it/s 0.5s
                   all        155        105       0.84      0.914      0.882      0.672

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     56/150      3.21G     0.5716     0.4528      1.062          6        512: 100% ━━━━━━━━━━━━ 44/44 11.4it/s 3.9s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 9.5it/s 0.5s
                   all        155        105      0.839      0.924      0.899      0.683

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     57/150      3.21G     0.5348     0.4348      1.058         13        512: 100% ━━━━━━━━━━━━ 44/44 11.8it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.9it/s 0.5s
                   all        155        105      0.901      0.876      0.896      0.663

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     58/150      3.21G     0.5438     0.4574      1.068         15        512: 100% ━━━━━━━━━━━━ 44/44 11.8it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.4it/s 0.5s
                   all        155        105      0.859      0.848      0.891      0.674

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     59/150      3.21G     0.5588     0.4326       1.07          7        512: 100% ━━━━━━━━━━━━ 44/44 11.6it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.7it/s 0.5s
                   all        155        105      0.832      0.914      0.881      0.681

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     60/150      3.21G     0.5704      0.447      1.087         12        512: 100% ━━━━━━━━━━━━ 44/44 11.9it/s 3.7s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.5it/s 0.5s
                   all        155        105      0.831       0.89      0.877      0.667

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     61/150      3.21G     0.5869     0.4432      1.088         11        512: 100% ━━━━━━━━━━━━ 44/44 11.7it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 8.8it/s 0.6s
                   all        155        105      0.855      0.896      0.896      0.675

      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size
     62/150      3.21G     0.5354      0.406      1.067         10        512: 100% ━━━━━━━━━━━━ 44/44 11.5it/s 3.8s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 10.5it/s 0.5s
                   all        155        105      0.858      0.862      0.878      0.649
EarlyStopping: Training stopped early as no improvement observed in last 25 epochs. Best results observed at epoch 37, best model saved as best.pt.
To update EarlyStopping(patience=25) pass a new patience value, i.e. `patience=300` or use `patience=0` to disable EarlyStopping.

62 epochs completed in 0.081 hours.
Optimizer stripped from /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/runs/regularize/regularize_run_2/weights/last.pt, 22.5MB
Optimizer stripped from /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/runs/regularize/regularize_run_2/weights/best.pt, 22.5MB

Validating /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/runs/regularize/regularize_run_2/weights/best.pt...
Ultralytics 8.3.252 🚀 Python-3.12.12 torch-2.9.0+cu126 CUDA:0 (NVIDIA A100-SXM4-40GB, 40507MiB)
Model summary (fused): 72 layers, 11,125,971 parameters, 0 gradients, 28.4 GFLOPs
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 5/5 3.5it/s 1.4s
                   all        155        105      0.858      0.865      0.886      0.672
Speed: 0.1ms preprocess, 4.2ms inference, 0.0ms loss, 0.9ms postprocess per image
Results saved to /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/runs/regularize/regularize_run_2
In [ ]:
# --- CONFIGURATION ---
DRIVE_MODEL_DIR = DRIVE_MODEL_DIR
RUNS_DIR = 'runs/detect/runs/regularize/regularize_run_2' # Ultralytics default save path
BEST_WEIGHTS_FILENAME = 'best_regularize_2.pt'
OUTPUT_WEIGHTS_NAME = 'weights_regularize_2.pt'

# --- SAVE WEIGHTS TO GOOGLE DRIVE ---
save_weights_to_drive(RUNS_DIR, DRIVE_MODEL_DIR, BEST_WEIGHTS_FILENAME, OUTPUT_WEIGHTS_NAME)
In [ ]:
# Run 2
visualize_training_results(RUNS_DIR)
No description has been provided for this image
============================================================
📈 DETAILED TRAINING STATISTICS
============================================================
Total Epochs: 62

🎯 Best mAP50: 0.8989 (Epoch 55)
🎯 Best mAP50-95: 0.6863 (Epoch 36)

📊 Final Metrics:
   mAP50: 0.8782
   mAP50-95: 0.6494
   Precision: 0.8579
   Recall: 0.8624
============================================================

All losses decrease smoothly and plateau early around epoch 30. Box and Class losses converge to ~0.5-0.6, showing good learning. Very stable training with no spikes after epoch 10.

mAP50 peaks around epoch 56 with ~0.9, then stabilizes at 87-89% with slight oscillations. Model learned quickly and plateaued early - small improvement after epoch 20. The model is too powerful for the task at hand.

Precision & recall show excellent balance hovering around 82-88% throughout training. High recall (92.4%) means very few missed Santas, which is what we want.

Overfitting check shows a generalizxation gap of ~1.0, indicating mild overfitting that doesn't worsen over time. Both losses converge after epoch 20, when model has found optimal balance.

The issue is almost no improvement after epoch 20-30, and the mode lwith 11M on such small dataset is an overkill. THe regularization might also be too intense.

Recommendations: Box loss should be 0.1-0.4, CLS loss should be similarly 0.1-0.4 and DLF loss ~0.5-1.0.

High Box Loss means either inaccurate coordinates or poor scale handling. We can in Tuning Notebook increase box gain in hyperparameters (box=10.0).

Look at the Target Ratio = Train Loss/Val Loss​ = 1.0 or 1.5.

Test Set¶

In [ ]:
# On a TEST SET
# Run validation on the test split
model = YOLO('./yolov8_results/best_regularize_2.pt')
metrics = model.val(data=dataset_yaml, split='test')
print(f"Test results saved to: {metrics.save_dir}")

# Precision, recall, and mAP results
precision = metrics.results_dict['metrics/precision(B)']
recall = metrics.results_dict['metrics/recall(B)']
mAP50 = metrics.results_dict['metrics/mAP50(B)']
mAP50_95 = metrics.results_dict['metrics/mAP50-95(B)']

print(f"Precision: {precision:.2f}")
print(f"Recall: {recall:.2f}")
print(f"mAP50: {mAP50:.2f}")
print(f"mAP50-95: {mAP50_95:.2f}")
Ultralytics 8.3.252 🚀 Python-3.12.12 torch-2.9.0+cpu CPU (AMD EPYC 7B12)
Model summary (fused): 72 layers, 11,125,971 parameters, 0 gradients, 28.4 GFLOPs
Downloading https://ultralytics.com/assets/Arial.ttf to '/root/.config/Ultralytics/Arial.ttf': 100% ━━━━━━━━━━━━ 755.1KB 5.0MB/s 0.1s
val: Fast image access ✅ (ping: 0.7±0.2 ms, read: 0.0±0.0 MB/s, size: 35.9 KB)
val: Scanning /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/Santa-10/test/labels.cache... 95 images, 42 backgrounds, 0 corrupt: 100% ━━━━━━━━━━━━ 95/95 16.6Mit/s 0.0s
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 6/6 21.5s/it 2:09
                   all         95         53      0.875      0.923      0.927      0.732
Speed: 0.6ms preprocess, 110.5ms inference, 0.0ms loss, 0.6ms postprocess per image
Results saved to /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/val4
Test results saved to: /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/runs/detect/val4
Precision: 0.87
Recall: 0.92
mAP50: 0.93
mAP50-95: 0.73
In [ ]:
RUNS_DIR = 'runs/detect/val4'

# F1 curve
f1_path = os.path.join(RUNS_DIR, 'BoxF1_curve.png')
display(Image(filename=f1_path, width=600))

# Precision Recall  curve
pr_path = os.path.join(RUNS_DIR, 'BoxPR_curve.png')
display(Image(filename=pr_path, width=600))

# Confusion matrix
cm_path = os.path.join(RUNS_DIR, 'confusion_matrix.png')
display(Image(filename=cm_path, width=600))
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image

The clear F1 peak near 0.80 provides the optimal confidence threshold to use if we want the most balanced performance in a real-world application.

The PR curve demonstrates high robustness, meaning the model maintains high accuracy even as we lower thresholds to catch more "difficult" Santas.

The model correctly identified 51/53 Santas, only 2 Santas were missed (predicted as background), which is an excellent result for our goal of catching as many as possible. The model "hallucinated" 6 Santas where there was only background, which explains why our precision is slightly lower than your recall.

In [ ]:
show_image_results(RUNS_DIR, 0)
print()
show_image_results(RUNS_DIR, 1)
Output hidden; open in https://colab.research.google.com to view.

Run 3: More regularized configuration on NANO YOLO¶

Is nano version enouigh for our needs without sacrificing Recall?

In [ ]:
# Run 3 - use config_2 on nano model
MODEL_PATH = './models_cache/yolov8n.pt'
model = YOLO(MODEL_PATH)

# Use even lighter regularization, finetune_from_overfit
regularized_config_3 = {
    'data': dataset_yaml,
    'epochs': 180,
    'imgsz': 512,
    'batch': 16,
    'patience': 20,
    'device': 'cpu',
    'augment': True,

    # Very light augmentation
    'degrees': 2.0,         # Rotation needs to be more subtle
    'translate': 0.1,
    'scale': 0.6,           # 0.3 was very low and might provide enough variance.
    'fliplr': 0.5,
    'mosaic': 0.3,           # improves generalization
    'mixup': 0.0,

    'lr0': 0.01,
    'lrf': 0.01,
    'momentum': 0.937,
    'weight_decay': 0.00025, # reduce regularization from standard value
    'dropout': 0.0,

    'optimizer': 'AdamW',
    'cos_lr': True,

    'verbose': True,
    'save': True,
    'project': 'runs/regularize',
    'name': 'regularize_run_3',
    'val': True,
    'exist_ok': True
}
In [ ]:
# --- RUN 3
# --- TRAIN ---
print("🚀 Starting training (regularized) ...")
results = model.train(**regularized_config_3)
In [ ]:
# --- CONFIGURATION ---
RUNS_DIR = 'runs/detect/runs/regularize/regularize_run_3' # Ultralytics default save path
# BEST_WEIGHTS_FILENAME = 'best_regularize_3.pt'
# OUTPUT_WEIGHTS_NAME = 'weights_regularize_3.pt'

# # --- SAVE WEIGHTS TO GOOGLE DRIVE ---
# save_weights_to_drive(RUNS_DIR, DRIVE_MODEL_DIR, BEST_WEIGHTS_FILENAME, OUTPUT_WEIGHTS_NAME)
In [ ]:
# Run 3
visualize_training_results(RUNS_DIR)
No description has been provided for this image
============================================================
📈 DETAILED TRAINING STATISTICS
============================================================
Total Epochs: 140

🎯 Best mAP50: 0.9201 (Epoch 109)
🎯 Best mAP50-95: 0.6715 (Epoch 109)

📊 Final Metrics:
   mAP50: 0.9008
   mAP50-95: 0.6524
   Precision: 0.8648
   Recall: 0.8667
============================================================

The metrics show we have successfully reached a good level of generalization, but we are now struggling with specificity (too many false positives), although we are more worried about false negatives. The model is seeing background elements (decorations, trees, lights, people) and wrongly labeling them as Santa.

Flase negatives. These errors reduce the Recall. The model is missing a few true Santa instances. It successfully finds most of actual Santas (Recall = 81%), but precision (0.7725) is moderata, the model is wrong almost about every 5. time when it thinks it found Santa.

In [ ]:
# On a TEST SET
# Run validation on the test split
model = YOLO('./yolov8_results/best_regularize_3.pt')
metrics = model.val(data=dataset_yaml, split='test')
print(f"Test results saved to: {metrics.save_dir}")

# Precision, recall, and mAP results
precision = metrics.results_dict['metrics/precision(B)']
recall = metrics.results_dict['metrics/recall(B)']
mAP50 = metrics.results_dict['metrics/mAP50(B)']
mAP50_95 = metrics.results_dict['metrics/mAP50-95(B)']

print(f"Precision: {precision:.2f}")
print(f"Recall: {recall:.2f}")
print(f"mAP50: {mAP50:.2f}")
print(f"mAP50-95: {mAP50_95:.2f}")
Ultralytics 8.3.252 🚀 Python-3.12.12 torch-2.9.0+cu126 CUDA:0 (NVIDIA A100-SXM4-40GB, 40507MiB)
Model summary (fused): 72 layers, 3,005,843 parameters, 0 gradients, 8.1 GFLOPs
val: Fast image access ✅ (ping: 0.6±0.2 ms, read: 0.0±0.0 MB/s, size: 31.2 KB)
val: Scanning /content/drive/.shortcut-targets-by-id/1DgLXJnKkWgH1Se3L7wSkYBuXljrUEqpi/MC/Santa-10/test/labels... 95 images, 42 backgrounds, 0 corrupt: 100% ━━━━━━━━━━━━ 95/95 5.3it/s 17.8s
val: New cache created: /content/drive/.shortcut-targets-by-id/1DgLXJnKkWgH1Se3L7wSkYBuXljrUEqpi/MC/Santa-10/test/labels.cache
                 Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100% ━━━━━━━━━━━━ 6/6 2.9it/s 2.1s
                   all         95         53      0.926      0.811      0.901      0.677
Speed: 1.0ms preprocess, 4.2ms inference, 0.0ms loss, 2.3ms postprocess per image
Results saved to /content/drive/.shortcut-targets-by-id/1DgLXJnKkWgH1Se3L7wSkYBuXljrUEqpi/MC/runs/detect/val5
Test results saved to: /content/drive/.shortcut-targets-by-id/1DgLXJnKkWgH1Se3L7wSkYBuXljrUEqpi/MC/runs/detect/val5
Precision: 0.93
Recall: 0.81
mAP50: 0.90
mAP50-95: 0.68
In [ ]:
RUNS_DIR = 'runs/detect/val5'

from IPython.display import display, Image

# F1 curve
f1_path = os.path.join(RUNS_DIR, 'BoxF1_curve.png')
display(Image(filename=f1_path, width=600))

# Precision Recall  curve
pr_path = os.path.join(RUNS_DIR, 'BoxPR_curve.png')
display(Image(filename=pr_path, width=600))

# Confusion matrix
cm_path = os.path.join(RUNS_DIR, 'confusion_matrix.png')
display(Image(filename=cm_path, width=600))
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image

The curve for the current run is exceptionally strong, maintaining near-perfect Precision (1.0) until Recall reaches approximately 0.7. The flat line at 1.0 Precision means the model is only making "high-certainty" predictions. It has perfectly memorized the most common Santa features, so it is 100% right—but only for the "easy" 70% of our data (over-specialization).

If we look at your Overfitting Check plot from the training set above, we can see the validation loss (red) starting to trend upward while the training loss (blue) continues to dive. This onfirms that the model is performing significantly better on its memorized training data than on the validation Santas.

The area under the curve indicates an mAP@0.5 of 0.901. While slightly lower than the 0.927 seen in a previous iteration, it remains highly competitive.

However, we see that now 7/53 Santas were not recognized, which indicates that for our purpose the model is worse.

In [ ]:
show_image_results(RUNS_DIR, 2)
print()
show_image_results(RUNS_DIR, 0)
No description has been provided for this image

No description has been provided for this image

In the last row we see, that the model has picked up on patterns well, as it identified also a Santa that is not annotated in the dataset (image '156_Santa_jpg'), but as it is under the confidence threshold, it still performs worse thatn the S model.

In [ ]:
!jupyter nbconvert --to html '/content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/03_model_regularization.ipynb'
[NbConvertApp] Converting notebook /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/03_model_regularization.ipynb to html
[NbConvertApp] WARNING | Alternative text is missing on 11 image(s).
[NbConvertApp] Writing 6319620 bytes to /content/drive/MyDrive/FHNW/HS_25/DLBS/minichallenge_hs25_object_detection/MC/03_model_regularization.html